<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>embedme: ComPort类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.8 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li class="current"><a href="annotated.html"><span>类</span></a></li>
      <li><a href="files.html"><span>文件</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>类列表</span></a></li>
      <li><a href="classes.html"><span>类索引</span></a></li>
      <li><a href="hierarchy.html"><span>类继承关系</span></a></li>
      <li><a href="functions.html"><span>类成员</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">类</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="class_com_port-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">ComPort类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>串口设备类.  
 <a href="class_com_port.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="_com_port_8h_source.html">ComPort.h</a>&gt;</code></p>
<div class="dynheader">
类 ComPort 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_com_port.png" usemap="#ComPort_map" alt=""/>
  <map id="ComPort_map" name="ComPort_map">
<area href="class_i_o_device.html" title="IO设备抽象类 " alt="IODevice" shape="rect" coords="0,0,65,24"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a18f814468b55405add84e4f8271a95e9"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#a18f814468b55405add84e4f8271a95e9">ComPort</a> ()</td></tr>
<tr class="memdesc:a18f814468b55405add84e4f8271a95e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造函数  <a href="#a18f814468b55405add84e4f8271a95e9">更多...</a><br /></td></tr>
<tr class="separator:a18f814468b55405add84e4f8271a95e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60f4557b68a559975a0404f77480e038"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#a60f4557b68a559975a0404f77480e038">~ComPort</a> ()</td></tr>
<tr class="memdesc:a60f4557b68a559975a0404f77480e038"><td class="mdescLeft">&#160;</td><td class="mdescRight">析构函数  <a href="#a60f4557b68a559975a0404f77480e038">更多...</a><br /></td></tr>
<tr class="separator:a60f4557b68a559975a0404f77480e038"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae244aab39a2a0321016bc21c5164e24"><td class="memItemLeft" align="right" valign="top">virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#aae244aab39a2a0321016bc21c5164e24">open</a> (const char *devName, sint32 ioMode)</td></tr>
<tr class="memdesc:aae244aab39a2a0321016bc21c5164e24"><td class="mdescLeft">&#160;</td><td class="mdescRight">打开串口  <a href="#aae244aab39a2a0321016bc21c5164e24">更多...</a><br /></td></tr>
<tr class="separator:aae244aab39a2a0321016bc21c5164e24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75e33f87300daf62df4ae5bd21c0cbc4"><td class="memItemLeft" align="right" valign="top">virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#a75e33f87300daf62df4ae5bd21c0cbc4">close</a> ()</td></tr>
<tr class="memdesc:a75e33f87300daf62df4ae5bd21c0cbc4"><td class="mdescLeft">&#160;</td><td class="mdescRight">关闭串口  <a href="#a75e33f87300daf62df4ae5bd21c0cbc4">更多...</a><br /></td></tr>
<tr class="separator:a75e33f87300daf62df4ae5bd21c0cbc4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a881598304b2cc737043030f99e930d8e"><td class="memItemLeft" align="right" valign="top">virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#a881598304b2cc737043030f99e930d8e">readData</a> (char *buf, sint32 len, sint32 timeoutMs=-1)</td></tr>
<tr class="memdesc:a881598304b2cc737043030f99e930d8e"><td class="mdescLeft">&#160;</td><td class="mdescRight">读串口数据  <a href="#a881598304b2cc737043030f99e930d8e">更多...</a><br /></td></tr>
<tr class="separator:a881598304b2cc737043030f99e930d8e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6559f7c675d8e7ddd00a016da4d3c783"><td class="memItemLeft" align="right" valign="top">virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#a6559f7c675d8e7ddd00a016da4d3c783">writeData</a> (const char *buf, sint32 len, sint32 timeoutMs=-1)</td></tr>
<tr class="memdesc:a6559f7c675d8e7ddd00a016da4d3c783"><td class="mdescLeft">&#160;</td><td class="mdescRight">写串口数据  <a href="#a6559f7c675d8e7ddd00a016da4d3c783">更多...</a><br /></td></tr>
<tr class="separator:a6559f7c675d8e7ddd00a016da4d3c783"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6f5483e8166888e697265f1dfc3fddf"><td class="memItemLeft" align="right" valign="top">virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#ae6f5483e8166888e697265f1dfc3fddf">setAttribute</a> (sint32 attr, sint32 value)</td></tr>
<tr class="memdesc:ae6f5483e8166888e697265f1dfc3fddf"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置串口属性  <a href="#ae6f5483e8166888e697265f1dfc3fddf">更多...</a><br /></td></tr>
<tr class="separator:ae6f5483e8166888e697265f1dfc3fddf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa470a678897eaa01b7ffd6d5f8519ac4"><td class="memItemLeft" align="right" valign="top">virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_com_port.html#aa470a678897eaa01b7ffd6d5f8519ac4">getAttribute</a> (sint32 attr)</td></tr>
<tr class="memdesc:aa470a678897eaa01b7ffd6d5f8519ac4"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取串口属性  <a href="#aa470a678897eaa01b7ffd6d5f8519ac4">更多...</a><br /></td></tr>
<tr class="separator:aa470a678897eaa01b7ffd6d5f8519ac4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
额外继承的成员函数</h2></td></tr>
<tr class="inherit_header pro_attribs_class_i_o_device"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_class_i_o_device')"><img src="closed.png" alt="-"/>&#160;Protected 属性 继承自 <a class="el" href="class_i_o_device.html">IODevice</a></td></tr>
<tr class="memitem:a5ab8e2aa83ad8a53d8ddbb19b23d3688 inherit pro_attribs_class_i_o_device"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5ab8e2aa83ad8a53d8ddbb19b23d3688"></a>
sint32&#160;</td><td class="memItemRight" valign="bottom"><b>m_fd</b></td></tr>
<tr class="separator:a5ab8e2aa83ad8a53d8ddbb19b23d3688 inherit pro_attribs_class_i_o_device"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4900690afb4b4d17f90cfe3a9fb504e inherit pro_attribs_class_i_o_device"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa4900690afb4b4d17f90cfe3a9fb504e"></a>
std::string&#160;</td><td class="memItemRight" valign="bottom"><b>m_devName</b></td></tr>
<tr class="separator:aa4900690afb4b4d17f90cfe3a9fb504e inherit pro_attribs_class_i_o_device"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e930bf51c6a266e5be5b2ed62c7ecfa inherit pro_attribs_class_i_o_device"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5e930bf51c6a266e5be5b2ed62c7ecfa"></a>
sint32&#160;</td><td class="memItemRight" valign="bottom"><b>m_openMode</b></td></tr>
<tr class="separator:a5e930bf51c6a266e5be5b2ed62c7ecfa inherit pro_attribs_class_i_o_device"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>串口设备类. </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a class="anchor" id="a18f814468b55405add84e4f8271a95e9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ComPort::ComPort </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造函数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>none </dd></dl>
<dl class="section note"><dt>注解</dt><dd>默认串口波特率为9600,8位数据位,1位停止位,无奇偶校验位,无流控 </dd></dl>

</div>
</div>
<a class="anchor" id="a60f4557b68a559975a0404f77480e038"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ComPort::~ComPort </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>析构函数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>none </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a class="anchor" id="a75e33f87300daf62df4ae5bd21c0cbc4"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 ComPort::close </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>关闭串口 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

<p>重载 <a class="el" href="class_i_o_device.html#a1120c9e7a7c4d0b23083effbe4cb6279">IODevice</a> .</p>

</div>
</div>
<a class="anchor" id="aa470a678897eaa01b7ffd6d5f8519ac4"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 ComPort::getAttribute </td>
          <td>(</td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>attr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取串口属性 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">attr</td><td>属性类型COM_ATTR_E </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>sint32 成功返回属性对应的值,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

<p>实现了 <a class="el" href="class_i_o_device.html">IODevice</a>.</p>

</div>
</div>
<a class="anchor" id="aae244aab39a2a0321016bc21c5164e24"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 ComPort::open </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>devName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>ioMode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>打开串口 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">devName</td><td>设备名称,如/dev/ttySAC0 </td></tr>
    <tr><td class="paramname">mode</td><td>设备属性,如IO_MODE_RD_ONLY </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>sint32 成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>如果要修改串口属性,必须在open前进行设置 </dd></dl>

<p>重载 <a class="el" href="class_i_o_device.html#a426aac91300f077d57b1f30c76c7c430">IODevice</a> .</p>

</div>
</div>
<a class="anchor" id="a881598304b2cc737043030f99e930d8e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 ComPort::readData </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>timeoutMs</em> = <code>-1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>读串口数据 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>存放读取的数据的缓存 </td></tr>
    <tr><td class="paramname">len</td><td>buf缓存的大小 </td></tr>
    <tr><td class="paramname">timeoutMs</td><td>超时时间,-1:阻塞,0:立即返回,&gt;0:超时时间ms </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>sint32 成功返回读取的数据长度,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

<p>实现了 <a class="el" href="class_i_o_device.html">IODevice</a>.</p>

</div>
</div>
<a class="anchor" id="ae6f5483e8166888e697265f1dfc3fddf"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 ComPort::setAttribute </td>
          <td>(</td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>attr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置串口属性 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">attr</td><td>属性类型COM_ATTR_E </td></tr>
    <tr><td class="paramname">value</td><td>属性对应的值 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>sint32 成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

<p>实现了 <a class="el" href="class_i_o_device.html">IODevice</a>.</p>

</div>
</div>
<a class="anchor" id="a6559f7c675d8e7ddd00a016da4d3c783"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 ComPort::writeData </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>timeoutMs</em> = <code>-1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>写串口数据 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>要写入的数据 </td></tr>
    <tr><td class="paramname">len</td><td>写入数据的长度 </td></tr>
    <tr><td class="paramname">timeoutMs</td><td>超时时间,-1:阻塞,0:立即返回,&gt;0:超时时间ms </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>sint32 成功返回写入的数据长度,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

<p>实现了 <a class="el" href="class_i_o_device.html">IODevice</a>.</p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>libemb/inc/<a class="el" href="_com_port_8h_source.html">ComPort.h</a></li>
<li>libemb/src/ComPort.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
生成于 2016年 七月 7日 星期四 19:49:38 , 为 embedme使用  &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>
